package com.neusoft.lohas.modules.ivm.entity.business;

import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;

import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.neusoft.lohas.common.persistence.IdEntity;
import com.neusoft.lohas.modules.ivm.entity.merchant.Merchant;
import com.neusoft.lohas.modules.ivm.entity.product.ProductClassify;

/**
 * 商圈对应商店类
 * @author jackie.liu
 * @version 2015-01-29
 */
@Entity
@Table(name = "ivm_business_hangstore")
@DynamicInsert
@DynamicUpdate
public class HangStore extends IdEntity<HangStore> {

	private static final long serialVersionUID = 1L;
	private Merchant merchant; // 商户信息
	private ProductClassify classify;  //对应商户的一级分类
	private String logoUrl; //挂的一级分类的图片
	private String status; //状态：0正常，1取消
	private int sort; //排序号
	
	public HangStore() {
		super();
		this.sort = 30;
	}

	public HangStore(String id) {
		this();
		this.id = id;
	}
	
	@ManyToOne
	@JoinColumn(name="merchant_id")
	@NotFound(action = NotFoundAction.IGNORE)
	@JsonIgnore
	@NotNull(message="所属商户信息不能为空")
	public Merchant getMerchant() {
		return merchant;
	}

	public void setMerchant(Merchant merchant) {
		this.merchant = merchant;
	}

	@ManyToOne
	@JoinColumn(name="classify_id")
	@NotFound(action = NotFoundAction.IGNORE)
	@NotNull(message="商品一级分类不能为空")
	public ProductClassify getClassify() {
		return classify;
	}

	public void setClassify(ProductClassify classify) {
		this.classify = classify;
	}

	public String getLogoUrl() {
		return logoUrl;
	}

	public void setLogoUrl(String logoUrl) {
		this.logoUrl = logoUrl;
	}

	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	public int getSort() {
		return sort;
	}

	public void setSort(int sort) {
		this.sort = sort;
	}
	
	// 正常/取消
	public static final String OK = "0";
	public static final String NOTOK = "1";
	
}

	
